But before you can let your imagination run wild, you need to take care of the basics. Let's start by generating the board.
Each square of the chessboard is identified by a letter-number pair. The vertical columns of squares, called files, are labeled A through H. The horizontal rows of squares, called ranks, are numbered 1 to 8.
Implement the rank_range/0 function. It should return a range of integers, from 1 to 8.
Implement the file_range/0 function. It should return a range of integers, from the code point of the uppercase letter A, to the code point of the uppercase letter H.
Implement the ranks/0 function. It should return a list of integers, from 1 to 8. Do not write the list by hand, generate it from the range returned by the rank_range/0 function.
Implement the files/0 function. It should return a list of letters (strings), from "A" to "H". Do not write the list by hand, generate it from the range returned by the file_range/0 function.
https://exercism.org/tracks/elixir/exercises/chessboard
defmodule Chessboard do
@moduledoc """
practice range
"""
def rank_range, do: 1..8
def file_range, do: ?A..?H
def ranks, do: rank_range() |> Enum.to_list
def files, do: file_range() |> Enum.map(&(<<&1>>))
end